package demo.practice.leetcode_eveyday;

public class P551 {

    public boolean checkRecord(String s) {
        char[] chars = s.toCharArray();
        int sumA = 0;
        int cL = 0;
        for (char aChar : chars) {
            if (aChar == 'A') {
                sumA++;
            }
            if (aChar == 'L') {

                cL++;
            } else {
                cL = 0;
            }

            if(sumA>=2 || cL>=3){
                return false;
            }
        }

        return true;
    }
}
